Carbon


GetFreeThreadCount

Header: Threads.h Carbon status: Supported

Determines how many threads are available to be allocated in a thread pool.

OSErr GetFreeThreadCount (
    ThreadStyle threadStyle, 
    SInt16 *freeCount
);
Parameter descriptions
threadStyle

The type of thread to get information about. Cooperative is the only type that you can specify. Historically, the Thread Manger supported two types of threads, preemptive and cooperative, but the Thread Manager no longer supports preemptive threads.

freeCount

On return, a pointer to the number of threads available to be allocated.

function result

A result code. Δ

DISCUSSION

The number of threads in the pool varies throughout execution of your application. Calls to CreateThreadPool add threads to the pool and calls to the function NewThread, when an existing thread is allocated, reduce the number of threads. You also add threads to the pool when you dispose of a thread with the DisposeThread function and specify that the thread be recycled.

Use the GetSpecificFreeThreadCount function to determine how many threads of a particular stack size are available.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)